JavaScript

$u.s.lTrim Function

Syntax

$u.s.lTrim(STRING as string [, CHR as string])

Arguments

str string

The string that has extra whitespace to remove from the beginning.

chrstring

(Optional) Specifies the characters to remove from the string.

Description

Trim the left of a string, removing spaces and any passed in characters.

Example

var string1 = '   this is a string with leading spaces';
string1 = $u.s.lTrim(string1);

var string1 = '    -   this string has a leading dash';
string1 = $u.s.lTrim(string1,' -');

/*the resulting string is 'this string has a leading dash'. The  leading spaces and - have been removed.*/